#!/usr/bin/python
##############################################################################
# 
# Copyright (C) Zenoss, Inc. 2007, all rights reserved.
# 
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
# 
##############################################################################


#
# Contained below is the class that tests elements located under
# the "Daemons" Tab in the Settings.
#
# Noel Brockett
#

import unittest

from util.selTestUtils import *

from SelTestBase import SelTestBase

class TestDaemons(SelTestBase):
    """Defines an object that runs tests under the Daemons tab in Settings"""

    def _goToDaemons(self):   
        sel = self.selenium
        sel.click("link=Settings")
        sel.wait_for_page_to_load("30000")
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")



    def testZeoctl(self):
        """Tests the ZeoCtl Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[1]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[4].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[1]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("manage_daemonAction:method")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[1]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("link=view config")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/table/tbody/tr[2]/td/table/tbody[2]/tr[1]/td/pre")
        self.failUnless(sel.is_text_present("ZEO configuration file"))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_editable("data"))
        self.failUnless("daemon true forever false backoff-limit 10 exit-codes 0, 2 directory $INSTANCE default-to-interactive true" in sel.get_text("data"))
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_text_present("ZEO configuration file"))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("link=view log")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_text_present("zeoctl Log File"))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[1]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
    
    def testZenHub(self):
        """Tests the ZenHub Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[8].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[7].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenhub Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenhub Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "Testing Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenhub Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenhub Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))

    def testZenPing(self):
        """Tests the ZenPing Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[4]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[10].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[4]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[9].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[3]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[4]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenping Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenping Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "Testing Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenping Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenping Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenping Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[4]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenping Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[4]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
    
    def testZenSysLog(self):
        """Tests the ZenSysLog Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[5]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[12].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[5]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[11].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[5]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[5]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zensyslog Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER VALUE"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zensyslog Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETER      VALUE\n\nTesting Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zensyslog Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        sel.type("data", "#PARAMETER      VALUE")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zensyslog Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[5]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zensyslog Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[5]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
  
    def testZenStatus(self):
        """Tests the ZenStatus Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[6]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[14].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[6]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[13].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[6]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[6]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenstatus Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("monitor localhost"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenstatus Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "monitor localhost Testing Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenstatus Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("monitor localhost Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        sel.type("data", "monitor localhost")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenstatus Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("monitor localhost"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[6]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenstatus Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[6]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
 
            

    def testZenActions(self):
        """Tests the ZenActions Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[7]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[16].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[7]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[15].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[7]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[7]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenactions Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenactions Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "Testing Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenactions Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenactions Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenactions Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[7]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenactions Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[7]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
 


    def testZenTrap(self):
        """Tests the ZenTrap Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[8]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[18].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[8]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[17].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[8]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[8]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zentrap Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER VALUE"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        sel.type("data", "#PARAMETER      VALUE Testing Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zentrap Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER VALUE Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zentrap Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETER      VALUE")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zentrap Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[8]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zentrap Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[8]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
   


    def testZenModeler(self):
        """Tests the ZenModeler Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[9]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[20].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[9]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[19].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[9]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[9]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenmodeler Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenmodeler Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "Testing Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenmodeler Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenmodeler Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenmodeler Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[9]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenmodeler Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[9]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
    


    def testZenPerfSnmp(self):
        """Tests the ZenPerfSnmp Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[10]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[22].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[10]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[21].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[10]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[10]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenperfsnmp Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER VALUE"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("monitor localhost"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenperfsnmp Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETER      VALUE\nmonitor         localhost\nTesting Time!")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenperfsnmp Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER VALUE"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("monitor localhost"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenperfsnmp Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETER      VALUE\nmonitor         localhost")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenperfsnmp Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[10]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenperfsnmp Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[10]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
 


    def _testZenCommand(self):
        """Tests the ZenCommand Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[11]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[24].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[11]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[23].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[11]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[11]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zencommand Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zencommand Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETERTesting time!      VALUE\nmonitor         localhost")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zencommand Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETERTesting time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zencommand Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETER      VALUE\nmonitor         localhost")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zencommand Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[11]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zencommand Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[11]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
 

    def testZenProcess(self):
        """Tests the ZenProcess Daemon"""
        sel = self.selenium
        self._goToDaemons()
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[12]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("document.forms[26].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[12]/td[4]/img[@src='/zport/dmd/img/red_dot.png']"))
        sel.click("document.forms[25].elements['manage_daemonAction:method']")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[12]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[12]/td[3]/a[1]")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenprocess Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenprocess Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETERTesting Time!      VALUE\nmonitor         localhost")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenprocess Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETERTesting Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=edit this configuration")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenprocess Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.type("data", "#PARAMETER      VALUE\nmonitor         localhost")
        sel.click("manage_saveConfigData:method")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenprocess Configuration File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("#PARAMETER"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failIf(sel.is_text_present("Testing Time!"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        sel.click("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[12]/td[2]/a")
        sel.wait_for_page_to_load("30000")
        try: self.failUnless(sel.is_text_present("zenprocess Log File"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        try: self.failUnless(sel.is_text_present("INFO zen.zenprocess"))
        except AssertionError, e: self.verificationErrors.append(str(e))
        sel.click("link=Daemons")
        sel.wait_for_page_to_load("30000")
        self.failUnless(sel.is_element_present("//div[@id='contentPane']/div/div/div[2]/table/tbody/tr[12]/td[4]/img[@src='/zport/dmd/img/green_dot.png']"))
 
if __name__ == "__main__":
        unittest.main()
